package com.qyhl.webtv.module_news.news.union.town;


import com.qyhl.webtv.commonlib.entity.news.UnionBean;

import java.util.List;

/**
 * Created by qyhl on 2017/12/1.
 */

public class TownListPresenter implements TownListContract.TownListPresenter {
    private TownListModel mModel;
    private TownListContract.TownListView mView;

    public TownListPresenter(TownListContract.TownListView mView) {
        this.mView = mView;
        this.mModel = new TownListModel(this);
    }

    @Override
    public void getDatas(String sectionId) {
        mModel.getDatas(sectionId);
    }

    @Override
    public void setDatas(List<UnionBean> beanList) {
        mView.setDatas(beanList);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            default:
                break;
        }
    }
}
